﻿@page
@model OpenPms.Areas.D.Pages.Setup.Rate.EditModel
@{
    ViewData["Title"] = "房价码 - 编辑";
}

<form method="post">
    <wx-input asp-hidden-1=Item.HotelId
              asp-for-1=Item.Id asp-readonly-1=""
              asp-for-2=Item.RateType asp-readonly-2=""
              asp-for-3=Item.Name
              asp-for-31=Item.PinYin
              asp-for-4=Item.CheckinTime
              asp-for-5=Item.CheckoutTime
              asp-for-7=Item.HourRoomLength
              asp-for-8=Item.HourRoomStepLength
              asp-for-9=Item.IsPublish
              asp-for-10=Item.IsDelete />

    <wx-buttons asp-link-text-1="保存" asp-link-type-1=EButtonType.Primary
                asp-link-text-2="取消" asp-page-2="./Index" />
    @if (Model.Item.RateType == ERateType.钟点房)
    {
        <wx-buttons asp-link-text-3="正常房价" asp-page-3="./EditPriceBefore" asp-route-3-rateId=Item.Id asp-route-3-rateName=Item.Name
                    asp-link-text-4="超时房价" asp-page-4="./EditPriceBefore" asp-route-4-rateId=Item.Id asp-route-4-rateName=Item.Name asp-const-4-HourRoomLength=1 />
    }
    else
    {
        <wx-buttons asp-link-text-3="房价" asp-page-3="./EditPriceBefore" asp-route-3-rateId=Item.Id asp-route-3-rateName=Item.Name />
    }

    @* asp-link-text-5="房量" asp-page-5="./EditQuantity" asp-route-5-rateId=Item.Id asp-route-5-rateName=Item.Name /> *@

</form>
@section Scripts {
    @{
        await Html.RenderPartialAsync("_ValidationScriptsPartial");
    }
    <script>
        var rn = $("#Item_Name");
        var py = $("#Item_PinYin")
        $(function () {
            rn.change(function () {
                $.get("@Url.Page("/Setup/RoomType/PinYin")" + `?id=${rn.val()}`, function (ret) {
                    py.val(ret);
                });
            });
            if ("@((int)Model.Item.RateType)" != "2") { //非钟点房
                $("#Div7").hide();
                $("#Div8").hide();
            }
        });
    </script>
}

